import 'package:finance_app/src/entities/sub_cards_entity.dart';

subCardsEntityFromJson(SubCardsEntity data, Map<String, dynamic> json) {
	if (json['token_id'] != null) {
		data.tokenId = json['token_id'] is String
				? int.tryParse(json['token_id'])
				: json['token_id'].toInt();
	}
	if (json['card_number'] != null) {
		data.cardNumber = json['card_number'].toString();
	}
	if (json['is_default'] != null) {
		data.isDefault = json['is_default'] is String
				? int.tryParse(json['is_default'])
				: json['is_default'].toInt();
	}
	return data;
}

Map<String, dynamic> subCardsEntityToJson(SubCardsEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['token_id'] = entity.tokenId;
	data['card_number'] = entity.cardNumber;
	data['is_default'] = entity.isDefault;
	return data;
}